Skip to content

移动 - MoveTo

函数简介

把鼠标移动到目的点(x, y)。

接口名称

MoveTo

DLL调用

int MoveTo(long ola, int x, int y);

参数说明

参数名类型说明
ola长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
x整数型目标X坐标。
y整数型目标Y坐标。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
# 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300)
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
cpp
var ola = com("OlaPlug.OlaSoft")
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
text
.局部变量 ola, OLAPlug
ola.创建 ()
' 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
// 移动到屏幕坐标 (500, 300)
ola.MoveTo(500, 300);

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
MoveTo(instance, 500, 300);
csharp
long instance = CreateCOLAPlugInterFace();
MoveTo(instance, 500, 300);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
MoveTo(instance, 500, 300)

返回值

1 成功,0 失败。

注意事项

  • 当已注册 SetMousePosCallbackEnableRealMouse 开启时,真实轨迹移动会对 终点 做坐标偏差矫正;未注册回调或未开真实轨迹时行为与原先一致。
  • 矫正阈值见 SetConfig 项 MousePosCallbackMinOffset